var Sequelize = require('sequelize');
var base = require('./base');

var TaskStatusModel = module.exports = base.define('task_status', {
  name: {
    type: Sequelize.STRING
  },
  sort: {
    type: Sequelize.INTEGER
  },
  create_time: {
    type: Sequelize.INTEGER
  }
}, {
  classMethods: {
    isDragToComplete: function(status_id) {
      return parseInt(status_id, 10) === TaskStatusModel.COMPLETE;
    },
    isDragToShowCase:function(status_id) {
      return parseInt(status_id, 10) === TaskStatusModel.SHOWCASE;
    },
    isDragToJointDebug:function(status_id) {
      return parseInt(status_id, 10) === TaskStatusModel.JOINT_DEBUG;
    }
  }
});

TaskStatusModel.WAITING = 10;
TaskStatusModel.DEVING = 20;
TaskStatusModel.JOINT_DEBUG = 30;
TaskStatusModel.SHOWCASE = 40;
TaskStatusModel.COMPLETE = 50;
